package com.example.controller;

import com.example.pojo.CodeTale;
import com.example.service.impl.SmsCodeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("code")
public class SmsCodeController {

    @Autowired
    private SmsCodeServiceImpl smsCodeService;

    @GetMapping("/sendCode")
    public String sendCode(String tela){
        String code = smsCodeService.sendUserCode(tela);
        return code;
    }

    @PostMapping("/checkCode")
    public boolean checkCode(CodeTale codeTale){
        boolean b = smsCodeService.checkCode(codeTale);
        return b;
    }
}
